home *** CD-ROM | disk | FTP | other *** search
- Path: news.kreonet.re.kr!usenet
- From: jwhahn@cair.kaist.ac.kr (Jung Hahn)
- Newsgroups: comp.lang.c++
- Subject: Re: ???Recursion and strings
- Date: Wed, 07 Feb 1996 11:46:36 GMT
- Organization: Applied Database Labs, K.A.I.S.T
- Message-ID: <3118910a.13494414@news.kreonet.re.kr>
- References: <4f44fg$74u@upsidedown.MTS.Net> <31188b9a.12102227@news.kreonet.re.kr>
- NNTP-Posting-Host: swine.kaist.ac.kr
- X-Newsreader: Forte Agent .99d/32.168
-
- On Wed, 07 Feb 1996 11:23:20 GMT, jwhahn@cair.kaist.ac.kr (Jung Hahn)
- wrote:
-
- >On Mon, 05 Feb 1996 07:26:43 GMT, bwilliam@MTS.Net (George) wrote:
- >
- >>How do I write a recursive function to print a string using only
- >>printf and %c to print it out.
- >>
- >>George at bwilliam@MTS.Net
- >>
- >
- >#include <stdio.h>
- >
- >foo( char *s, int len)
- >{
- >static int count=0;
- >
- > if ( count++ < len) {
- > printf( "%c", *s++);
- > foo( s, len);
- > }
- >}
- >
- >void main( void)
- >{
- > char *t = "Hello World\n";
- >
- > foo( t, strlen(t));
- >}
- >___________
- >
- > Name: Jung w. Hahn
- > Elm: jwhahn@cair.kaist.ac.kr
- > Phone: 042-869-2959
-
-
- Don't start whinning that from the second time you run foo()
- it doesn't not work... It's a time bomb...
- I Hope to hell you find out why ... :)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ___________
-
- Name: Jung w. Hahn
- Elm: jwhahn@cair.kaist.ac.kr
- Phone: 042-869-2959
-